apiready = function() {
    seajs.use(['../../V', "../../api", "../../jquery", "../../app", "../../service"], function(V, $api, $, app, service) {
        var vm = {
            el: '.container',
            data: {
                myIncome: '',
                shopId: '',
                bind: ''
            },
            mounted: function() {
                var that = this
                api.addEventListener({
                    name: 'shopIncome',
                }, function(ret, err) {
                    console.log("shopIncome listen")
                    that.getTradingMoney();
                });
            },
            methods: {
                close: function() {
                    api.closeWin({
                        name: 'shopIncome'
                    });
                },
                //--获取我的收入页面金额
                getTradingMoney: function() {
                    var that = this;
                    app.ajax(service['getTradingMoney'], {
                            data: {
                                values: {
                                    shop_code: this.shopId,
                                    unionid: $api.getStorage("shop_unionid"),
                                }
                            }
                        },
                        function(res) {
                            // var shopCode = res.data.shop_code; // 商店id
                            if (res.code) {
                                alert("错误号码code：" + res.code + "\n错误信息：" + res.message)
                            } else {
                                that.myIncome = res.data;
                                console.log(JSON.stringify(that.myIncome))
                                console.log("查询我的收入成功!");
                                if (that.myIncome.bindBank == 1) {
                                    that.bind = "已绑定";
                                } else {
                                    that.bind = "未绑定";
                                }
                            }
                        }
                    );
                },
                //--打开交易中列表页面
                openTradingList: function() {
                    app.openWin('tradingList', {
                        shopId: this.shopId
                    });
                },
                //--打开可提现列表页面
                openWithdrawMoney: function() {
                    app.openWin('withdrawMoney', {
                        shopId: this.shopId
                    });
                },
                //--打开结算中列表页面
                openClearingList: function() {
                    app.openWin('clearingList', {
                        shopId: this.shopId
                    });
                },
                //--打开已提现列表页面
                openAlreadyList: function() {
                    app.openWin('alreadyList', {
                        shopId: this.shopId
                    });
                },
                //--打开绑定银行卡页面
                openBindBank: function() {
                    app.openWin('bindBank', {
                        shopId: this.shopId
                    });
                },
                //--打开收支明细页面
                openShopIncomeDetail: function() {
                    app.openWin('shopIncomeDetail', {
                        shopId: this.shopId
                    });
                },
            },
            created: function() {
                var that = this;
                this.shopId = api.pageParam.shopId
                this.getTradingMoney();

                api.addEventListener({
                    name: 'backtToShopIncome'
                }, function(ret, err) {
                    that.getTradingMoney();
                });

            }
        };

        var even = function() {


        };
        var newVue = new Vue(vm);
        even();

    })
}
